/*
*
==============================================================================
*  Name        : 
*  Part of     : Omen Game Engine - DirectX 10 Plugin
*  Description : 
*  Version     : 1.0
*
*  Copyright (c) 2013 Lauri Kortevaara.
* 
==============================================================================
*/

#ifndef _DIRECTX_10_WINDOW_H_
#define _DIRECTX_10_WINDOW_H_

#include <Windows.h>

#include <map>

#ifndef WinMessageHandler
    typedef int (__stdcall* WinMessageHandler)(HWND,UINT,WPARAM,LPARAM);
#endif

namespace Omen {

    class DirectX_10_Window
    {
    public:
        DirectX_10_Window();
        DirectX_10_Window( const DirectX_10_Window& other );

        void createWindow( const int& windowWidth, const int& windowHeight, const bool& bFullScreen );

        int width() const;
        int height() const;

        static int (__stdcall WindowProcedure)(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
        static void setKernelMessageHandler( WinMessageHandler ptrFn ) { DirectX_10_Window::g_ptrKernelMsgHandler = ptrFn; }
   
        unsigned long windowHandle() const { return reinterpret_cast<unsigned long>(m_hwnd); }

    private:
        void registerWindowClass();
        void choosePixelFormat();

        static bool keys[256]; // Array Used For The Keyboard Routine
        HWND        m_hwnd;
        LPCWSTR     m_applicationName;
        HINSTANCE   m_hinstance;

        int         m_windowWidth, m_windowHeight;

        static WinMessageHandler                 g_ptrKernelMsgHandler;
        static std::map<HWND,DirectX_10_Window*> g_mapHwndDX_10_Window;
    };
}; // namespace Omen

#endif // _DIRECTX_10_WINDOW_H_